﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ContentPlaceHolderID="CenterContentPlaceHolder" runat="server">
    <asp:Timer ID="Timer1" runat="server" Enabled="true" OnTick="Timer1_Tick" Interval="120000">
    </asp:Timer>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="MainUpdatePanel">
        <ProgressTemplate>
            <asp:Label ID="UpdatingLabel" Text="Актуализиране на информацията" runat="server"></asp:Label>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="MainUpdatePanel" UpdateMode="Conditional" runat="server" EnableViewState="False">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>
        <ContentTemplate>
            <asp:Label ID="LastUpdatedLable" runat="server">
            </asp:Label><div id="text">
                <div id="lastnews">
                    <asp:ListView ItemPlaceholderID="itemPlaceHolder" DataKeyNames="ID" ID="FeedItemsListView"
                        runat="server" DataSourceID="FeedItemsDataSource" OnItemDataBound="FeedItemsListView_ItemDataBound"
                        OnDataBound="FeedItemsListView_DataBound" 
                        OnSelectedIndexChanging="FeedItemsListView_SelectedIndexChanging">
                        <ItemTemplate>
                            <li>
                                <asp:Label ID="PubDateLabel" runat="server" EnableViewState="false"></asp:Label>
                                <a href='ViewItem.aspx?id=<%# Eval("ID") %>' />
                                <%# Eval("Title") %>
                                </a>
                                <asp:ImageButton ToolTip="Вижте откъс" Height="11px" CommandName="Select" ImageUrl="~/images/viewItemContent.png"
                                    ID="ViewItemContentButton" runat="server" />
                                -
                                <asp:HyperLink Height="11px" ID="ViewExcerpt"
                                    runat="server" NavigateUrl='<%# "~/ViewPage.aspx?id=" + Eval("ID") %>'>
                                    <asp:Image ImageUrl="~/images/ViewExcerpt.png" runat="server" ID="ViewExcerptImage"
                                        Height="11px" />
                                </asp:HyperLink>
                                -
                                <asp:HyperLink ToolTip="Източник" rel="nofollow" Height="11px" ID="HyperLinkToSource"
                                    runat="server" NavigateUrl='<%# "~/Redirect.aspx?itemid=" + Eval("ID") %>'>
                                    <asp:Image ImageUrl="~/images/ViewFromSource.png" runat="server" ID="SourceImage"
                                        Height="11px" />
                                </asp:HyperLink>
                                - <a href='?feedid=<%# Eval("Feed.ID") %>'>
                                    <%# Eval("Feed.DisplayName") %>
                                </a>
                                <div enableviewstate="false" id="ItemContentDiv" class="ItemContentDiv" runat="server"
                                    visible="false">
                                </div>
                        </ItemTemplate>
                        <EmptyDataTemplate>
                            Няма новини
                        </EmptyDataTemplate>
                        <LayoutTemplate>
                            <ul id="lastnews">
                                <li id="itemPlaceHolder" runat="server"></li>
                            </ul>
                            <asp:DataPager ID="FeedItemsDataPager" QueryStringField="page" PageSize="45" PagedControlID="FeedItemsListView"
                                runat="server">
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" ShowPreviousPageButton="True"
                                        ShowNextPageButton="false" />
                                    <asp:NumericPagerField ButtonCount="10" ButtonType="Link" NextPageText="Next" />
                                    <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" ShowNextPageButton="False"
                                        ShowPreviousPageButton="false" />
                                </Fields>
                            </asp:DataPager>
                        </LayoutTemplate>
                    </asp:ListView>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:LinqDataSource ID="FeedItemsDataSource" runat="server" ContextTypeName="FeedAgregator.FeedSignalDataContext"
        OrderBy="PubDate desc" Select="new (ID,PubDate, Title, Feed,SeoUrl)" TableName="FeedItems">
    </asp:LinqDataSource>
</asp:Content>
<%-- Add content controls here --%>